package org.huamoxi.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import org.huamoxi.entity.base.BaseEntity;
import org.springframework.data.annotation.Id;
import org.springframework.security.core.GrantedAuthority;

import java.io.Serializable;

@Data
@TableName("tb_role")
@Accessors(chain = true) // 开启链式结构
public class Role extends BaseEntity implements GrantedAuthority, Serializable {

    // 主键
    @Id
    @TableId(value = "id", type = IdType.AUTO)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    Long id;

    // 角色名
    String roleName;

    // 角色备注
    String roleRemark;

    // 创建人id
    Long createUserId;

    @Override
    public String getAuthority() {
        return roleName;
    }
}
